#!/bin/sh

set -e

abort=false
if [ -L /usr/share/zoneminder/events ]; then
    l=$(readlink /usr/share/zoneminder/events)
    if [ "$l" != "/var/cache/zoneminder/events" ]; then
        abort=true
    fi
fi
if [ -L /usr/share/zoneminder/images ]; then
    l=$(readlink /usr/share/zoneminder/images )
    if [ "$l" != "/var/cache/zoneminder/images" ]; then
        abort=true
    fi
fi

if [ "$abort" = "true" ]; then
    cat >&2 << EOF 
Aborting installation of zoneminder due to non-default symlinks in
/usr/share/zoneminder for the images and/or events directory, which could
result in loss of data. Please move your data in each of these directories to
/var/cache/zoneminder before installing zoneminder from the package.
EOF
    exit 1

fi

#DEBHELPER#

exit 0
